#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QIcon>
#include <QDebug>
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    /*初始化按钮图标*/
    initButtunIcon();
    /*信号和槽*/
    connect(ui->prevBtn,&QPushButton::clicked,this,&MainWindow::handlePrevslot);
    connect(ui->nextBtn,&QPushButton::clicked,this,&MainWindow::handleNextslot);
    connect(ui->playBtn,&QPushButton::clicked,this,&MainWindow::handlePlayslot);

}

/*处理上一首按钮*/
void MainWindow::handlePrevslot()
{
    qDebug()<<"上一首"<<endl;
}
/*处理播放按钮*/
void MainWindow::handlePlayslot()
{
    qDebug()<<"播放"<<endl;
}
/*处理下一首按钮*/
void MainWindow::handleNextslot()
{
    qDebug()<<"下一首"<<endl;
}


/*设置按钮图标*/
void MainWindow::initButtunIcon()
{
    ui->prevBtn->setIcon(QIcon(":/img/pre.png"));
    ui->prevBtn->setIconSize(QSize(ui->prevBtn->width(),ui->prevBtn->height()));
    ui->prevBtn->setStyleSheet("QPushButton {background-color : rgba(255,255,255,0);}");

    ui->nextBtn->setIcon(QIcon(":/img/next.png"));
    ui->nextBtn->setIconSize(QSize(ui->nextBtn->width(),ui->nextBtn->height()));
    ui->nextBtn->setStyleSheet("QPushButton {background-color : rgba(255,255,255,0);}");

    ui->playBtn->setIcon(QIcon(":/img/play.png"));
    ui->playBtn->setIconSize(QSize(ui->playBtn->width(),ui->playBtn->height()));
    ui->playBtn->setStyleSheet("QPushButton {background-color : rgba(255,255,255,0);}");
}

MainWindow::~MainWindow()
{
    delete ui;
}
